using UnityEngine;

//道具代码
public class Prop : MonoBehaviour
{
    public enum ItemType
    {
        ExtraBomb,
        BlastRadius,
        SpeedIncrease,
    }

    public ItemType type;

    private void OnItemPickup(GameObject player)
    {
        switch (type)
        {
            case ItemType.ExtraBomb:
                GameApp.instance.bombAmount++;  // 炸弹数量加一
                GameApp.instance.bombsRemaining++;  // 剩余炸弹数量加一
                break;

            case ItemType.BlastRadius:
                GameApp.instance.explosionRange++;//爆炸范围增加
                break;

            case ItemType.SpeedIncrease:
                GameApp.instance.speed++;//移动速度增加
                break;
        }

        Destroy(gameObject);
    }

    private void OnTriggerEnter2D(Collider2D other)
    {
        if (other.CompareTag("Player"))
        {
            AudioManager.Instance.PlaSound("Eat");
            OnItemPickup(other.gameObject);
        }
    }
}